package drds.server.net.packet.auth;

import java.io.IOException;
import java.io.OutputStream;

import drds.server.net.packet.Packet;
import drds.server.net.packet.StreamUtil;

/**
 * 
 * @author 曹正辉<330937205@qq.com>
 * 
 */
public class AuthResponsePacket extends Packet {
	public byte result;
	public byte errorCode;

	public void ok() {
		result = 0;
		errorCode = 0;
	}

	public void error(byte type) {
		result = 1;
		errorCode = type;
	}

	public void write(OutputStream outputStream) throws IOException {
		StreamUtil.write(outputStream, result);
		StreamUtil.write(outputStream, errorCode);
	}

	@Override
	public int computePacketSize() {
		int size = 2;
		return size;
	}

}